package com.erlinyou.im.web.controller.base;

public class ResultJsonBuild<T> {
    public ResultJson<T> success(T obj) {
    	ResultJson<T> result = new ResultJson<T>();
//        result.setMsg("成功");
        result.setObj(obj);
        return result;
    }

    public ResultJson<T> success() {
        return success(null);
    }

    public ResultJson<T> error(Integer code, String msg) {
    	ResultJson<T> result = new ResultJson<T>();
        result.setCode(code);
//        result.setMsg(msg);
        return result;
    }
    
    public ResultJson<T> build(ResultCode resultCode) {
    	ResultJson<T> result = new ResultJson<T>();
        result.setCode(resultCode.getCode());
//        result.setMsg(resultCode.getMsg());
        return result;
    }
    
    public static ResultJson<Object> buildObj(ResultCode resultCode) {
    	ResultJson<Object> result = new ResultJson<Object>();
        result.setCode(resultCode.getCode());
//        result.setMsg(resultCode.getMsg());
        return result;
    }
}
